//
//  main.m
//  ocpro
//
//  Created by yons on 27.4.21.
//

#import <Foundation/Foundation.h>

#import <Foundation/Foundation.h>
#import "MyPerson.h"
#import <objc/runtime.h>
#import <malloc/malloc.h>
#import "Student.h"
#import "MyStudent.h"
#import "MyClassInfo.h"



struct Student_IMPL{
    Class isa;
    int _no;
    int _age;
};



///  对象内存大小
void instanceSize(){
    
    Student *stu = [[Student alloc]init];
    stu->_no = 4;
    stu->_age = 5;
    
    NSLog(@"%zd",class_getInstanceSize([Student class]));
    
    NSLog(@"%ld",malloc_size((__bridge const void *)(stu)));

    
    struct Student_IMPL *stuIm = (__bridge struct Student_IMPL *)(stu);
    NSLog(@"no is %d, age is %d", stuIm->_no, stuIm->_age);
    
}


/// 位域运算
void bitDomainOperation(){
    
//    MyPerson *person = [[MyPerson alloc] init];
//    person.thin = YES;
//    person.rich = NO;
//    person.handsome = NO;
//    person.tall = YES;
//
//    NSLog(@"thin:%d rich:%d hansome:%d tall:%d", person.isThin, person.isRich, person.isHandsome,person.isTall);
}


/// 窥探NSObject内存
void lookupInstanceSize(){
    
    NSObject *oj = [[NSObject alloc]init];
    
    NSLog(@"%zd",class_getInstanceSize([NSObject class]));
    
    NSLog(@"%ld",malloc_size((__bridge const void *)(oj)));
    
}

struct scc_objc_class{
    Class isa;
    Class superclass;
};


int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...

        
        Class a;
        
        
    }
    return 0;
}
